﻿using System;
using ilgolosone.Shared.Domain;

namespace ilgolosone.DomainModel.Entities
{
    [Serializable]
    public class Reservation : EntityBase, IAggregateRoot
    {
        public virtual DateTime ReservationDate { get; set; }
        public virtual DateTime FromTime { get; set; }
        public virtual DateTime ToTime { get; set; }
        public virtual Table Table { get; set; }
        public virtual string CustomerEMail { get; set; }

        public Reservation()
            : this(DateTime.Today, DateTime.Today, DateTime.Today, null, string.Empty)
        { }

        public Reservation(DateTime reservationDate, DateTime fromTime, DateTime toTime, Table table, string customerEMail)
        {
            ReservationDate = reservationDate;
            FromTime = fromTime;
            ToTime = toTime;
            Table = table;
            CustomerEMail = customerEMail;
        }

        public override string ToString()
        {
            return string.Format("Prenotazione del {0:d}, dalle {1:t} alle {2:t}", ReservationDate, FromTime, ToTime);
        }
    }
}
